#ifndef __VIEW_MOUSE_H
#define __VIEW_MOUSE_H

#include <lib/type.h>
#include <driver/view/view.h>
#include <driver/view/bitmap.h>

//mouse view size 
#define VIEW_MOUSE_SIZE 18

//mouse status
typedef enum
{
    VIEW_MOUSE_NORMAL = 0,
    VIEW_MOUSE_HOLD,
    VIEW_MOUSE_HELP,
    VIEW_MOUSE_PEN,
    VIEW_MOUSE_BUSY,
    VIEW_MOUSE_ACCURATE,
    VIEW_MOUSE_TEXT,
    VIEW_MOUSE_UNUSABLE,
    VIEW_MOUSE_VRESIZE,
    VIEW_MOUSE_HRESIZE,
    VIEW_MOUSE_DRESIZE1,
    VIEW_MOUSE_DRESIZE2,
    VIEW_MOUSE_RESIZEALL,
    VIEW_MOUSE_HAND,
    VIEW_MOUSE_INVISIABLE,
    VIEW_MOUSE_STATUS_NUM,
} view_mouse_status_t;

typedef struct
{
    view_bitmap_t *bmp; //status bmp
    int off_x;
    int off_y;
    view_mouse_status_t status;
} view_mouse_status_info_t;

typedef struct
{
    void (*motion)();
    void (*button_down)(int);
    void (*button_up)(int);
    void (*wheel)(int);
    int x, y;
    int local_x, local_y;
    int view_off_x, view_off_y;
    int click_x, click_y;
    int handle;

    view_t *view;
    view_mouse_status_t status;
    view_mouse_status_info_t status_table[VIEW_MOUSE_STATUS_NUM];
} view_mouse_t;

extern view_mouse_t view_mouse;

static inline void ViewMousePoll()
{
    ViewMouseRead(&view_mouse);
}

int ViewMouseInit();
int ViewMouseExit();
int ViewMouseHide();
int ViewMouseIsStatus(view_mouse_status_t status);
int ViewMouseSetStatus(view_mouse_status_t status);
int ViewMouseGetStatus(view_mouse_status_t *status);
int ViewMouseShow();
void ViewMouseDraw(view_mouse_status_t status);
int ViewMouseGetStatusInfo(view_mouse_status_info_t *info);
int ViewMouseSetStatusInfo(view_mouse_status_info_t info);

#endif